package com.example.recall_application.mvp.model.api;

import com.example.recall_application.mvp.entity.Config;
import com.example.recall_application.mvp.entity.ConfigRequest;
import com.example.recall_application.mvp.entity.WxUserInfo;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.Single;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * ================================================
 * 存放一些与 API 有关的东西,如请求地址,请求码等
 * <p>
 * Created by MVPArmsTemplate on 11/18/2019 14:45
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * ================================================
 */
public interface Api {
    /**
     * 获取白名单 筛选的配置信息
     * @param request
     * @return
     */
    @POST("?m=srv&a=up_user_app_info")
    Single<Config> getConfig(@Body ConfigRequest request);

    /**
     * 上传挂断记录
     * @param request
     * @return
     */
    @POST("?m=srv&a=call_tb_intercept")
    Observable<Object> pullIntercept(@Body ConfigRequest request);

    /**
     * 转接号码接口
     * @param request
     * @return
     */
    @POST("?m=srv&a=call_forwarding")
    Observable<Config> callForwarding(@Body ConfigRequest configRequest);

    /**
     * 上传日志
     * @param configRequest
     * @return
     */
    @POST("?m=srv&a=send_log")
    Observable<Config> upErrorLog(@Body ConfigRequest configRequest);

    @GET
    Observable<Config> getWxToken(@Url String url, @Query("appid") String appid,@Query("secret") String secret, @Query("code") String code, @Query("grant_type") String grant_type);

    @GET
    Observable<WxUserInfo> getWxUserInfo(@Url String url, @Query("access_token") String access_token,@Query("openid") String openid);

    @POST("/admin/?m=srv&a=post_userinfo")
    Observable<ResponseBody> upWxUserInfo(@Body WxUserInfo wxUserInfo);

    @POST("/admin/?m=srv&a=to_report_for_duty")
    Observable<Config> setConfigOption(@Body ConfigRequest config);
}
